import { TProductCart, cartSlice } from '../../store/reducers/slices/cartSlice'
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'
import { IconButton } from '@mui/material'
import { useAppDispatch } from '../../hooks'

const DeleteFromCartButton = ({ _id }: Pick<TProductCart, '_id'>) => {
	const dispatch = useAppDispatch()

	return (
		<IconButton
			onClick={() => dispatch(cartSlice.actions.deleteProduct({ _id }))}
		>
			<DeleteOutlineIcon />
		</IconButton>
	)
}

export default DeleteFromCartButton
